package com.csxy.six.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.csxy.six.entity.Blacklist;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface BlacklistMapper extends BaseMapper<Blacklist> {

    @Select("SELECT COUNT(*) FROM blacklist WHERE user_id = #{userId} " +
            "AND (end_time IS NULL OR end_time > NOW())")
    int checkIfBanned(Long userId);
}